package com.pavco.caribbeanvisit.shared.models;

import java.io.Serializable;
import java.util.ArrayList;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;

@PersistenceCapable(identityType = IdentityType.APPLICATION, 
    detachable = "false")
public class Attraction implements Serializable, Plottable {
  private static final long serialVersionUID = 1L;

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
  private String encodedKey;
  
  @Persistent
  private String countryName;

  @Persistent
  private String name;
  
  @Persistent
  private String description;

  @Persistent
  private float rating;
  
  @Persistent
  private int ratingCount;
  
  @Persistent
  private float latitude;
  
  @Persistent
  private float longitude;

  @Persistent
  private String url;

  @Persistent
  private ArrayList<Tag> tags = new ArrayList<Tag>();

  
  public String getEncodedKey() {
    return encodedKey;
  }

  public void setEncodedKey(String encodedKey) {
    this.encodedKey = encodedKey;
  }
  
  public float getLatitude() {
    return latitude;
  }
  
  public float getLongitude() {
    return longitude;
  }

  public void setLocation(float longitude, float latitude) {
    this.latitude = latitude;
    this.longitude = longitude;
  }

  public String getName() {
    return name;
  }
  
  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }
  
  public float getRating() {
    return rating;
  }

  public void setAttractionName(String name) {
    this.name = name;
  }

  public void setRatingCount(int ratingCount) {
    this.ratingCount = ratingCount;
  }

  public int getRatingCount() {
    return ratingCount;
  }
  
  public void addTag(Tag tag) {
    tags.add(tag);
  }
  
  public ArrayList<Tag> getTags() {
    if (tags == null) {
      return  new ArrayList<Tag>();
    }
    return tags;
  }

  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  public void setCountryName(String name) {
    this.countryName = name;
  }

  public String getCountryName() {
    return this.countryName;
  }
}